package gui;

import java.awt.Dimension;
import java.awt.event.ComponentListener;
import java.nio.file.Path;
import java.nio.file.Paths;

import javax.swing.JFrame;
import javax.swing.UIManager;

import eclMain.EveChatManager;

public class ECMUI {
	
	private static JFrame mainWindow = null;
	
	public ECMUI(EveChatManager ecm) {
		//set look and feel
		try {
	        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	    } 
	    catch (Exception e) {
	    	// Not much we can do here
	    }
		
		mainWindow = new JFrame("Eve Chat Manager");
		mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		ECMChannelManager manager = new ECMChannelManager();
		mainWindow.add(manager);
		
		mainWindow.setSize(new Dimension(600, 400));
		mainWindow.setVisible(true);
	}
	
	public static void addComponentListenerToFrame(ComponentListener listener) {
		mainWindow.addComponentListener(listener);
	}
	
	public static void main(String[] args) {
		Path logPath = Paths.get(System.getProperty("user.home"), "Documents", "EVE", "logs", "Chatlogs");
		EveChatManager ecm = new EveChatManager(logPath);
		new ECMUI(ecm);
	}
}
